<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::get('/', 							array('as' => 'home', 'uses' => 'HomeController@showWelcome'));
Route::post('/changeLanguage', 				array('as' => 'changeLanguage', 'uses' => 'HomeController@changeLanguage'));
Route::get('/en', 					array('as' => 'home.en', 'uses' => 'HomeController@showCategory'));
Route::get('/vi', 					array('as' => 'home.vi', 'uses' => 'HomeController@showCategory'));

Route::get('/en/women', 					array('as' => 'home.en.women', 'uses' => 'HomeController@showCategory'));



Route::get('/contact',                  array('as' => 'contact', 'uses' => 'ContactController@contact'));
Route::post('contact/store',            array('as' => 'contact.store', 'uses' =>'ContactController@store'));

Route::get('logout', array('as' => 'logout', function () {  
    if (BaseController::isLogin()) {
        Sentry::logout();
        Session::flush();
    }
    return Redirect::route('home');
}));


Route::get('/admin/login',                        array('as' => 'admin.login', 'uses' => 'HomeController@adminLogin'));
Route::post('admin-login',                        array('as' => 'admin.funlogin', 'uses' => 'UserController@adminLogin'));

Route::group(array('before' => 'minRoleManager'), function() {
	Route::post('/pull', 'NotificationController@pull');
	Route::post('/checkedNoti', 'NotificationController@checkedNoti');
	Route::post('/updateSeenStatus', 'NotificationController@updateSeenStatus');
	
	// Redactor drag and drop image
	Route::post('/ckeditorImage', 'HomeController@ckeditorImage');
	
	// Upload image file uploader
	Route::post('/upload', 'HomeController@upload');
	Route::get('/media/delete/{id}', 'HomeController@deleteMedia');
	Route::post('/editCaption', 'HomeController@editCaption');
	
	
    Route::get('/admin',                        array('as' => 'admin.panel', 'uses' => 'HomeController@adminPanel'));
    
    // Routes for user
    Route::get('/admin/user/list',              array('as' => 'admin.user.index', 'uses' => 'UserController@index'));
    Route::get('/admin/user/edit/{id}',         array('as' => 'admin.user.edit', 'uses' => 'UserController@edit'));
    Route::get('/admin/user/create',            array('as' => 'admin.user.create', 'uses' => 'UserController@create'));
    Route::post('/admin/user/storeInAdmin',     array('as' => 'admin.user.storeInAdmin', 'uses' => 'UserController@storeInAdmin'));
    Route::put('/admin/user/update/{id}',       array('as' => 'admin.user.update', 'uses' => 'UserController@update'));
    Route::delete('/admin/user/destroy/{id}',   array('as' => 'admin.user.destroy', 'uses' => 'UserController@destroy'));
    Route::post('/admin/user/updateStatus/{id}',array('as' => 'admin.user.updateStatus', 'uses' => 'UserController@updateStatus'));
	
	//Routes for categories
	Route::get('/admin/category/list',              array('as' => 'admin.category.index', 'uses' => 'CategoryController@index'));
	Route::get('/admin/category/edit/{id}',         array('as' => 'admin.category.edit', 'uses' => 'CategoryController@edit'));
	Route::get('/admin/category/create',            array('as' => 'admin.category.create', 'uses' => 'CategoryController@create'));
	Route::post('/admin/category/store',       		array('as' => 'admin.category.store', 'uses' => 'CategoryController@store'));
	Route::put('/admin/category/update/{id}',       array('as' => 'admin.category.update', 'uses' => 'CategoryController@update'));
	Route::delete('/admin/category/destroy/{id}',   array('as' => 'admin.category.destroy', 'uses' => 'CategoryController@destroy'));
    Route::post('/admin/category/updateStatus/{id}',array('as' => 'admin.category.updateStatus', 'uses' => 'CategoryController@updateStatus'));
	
	//Routes for product
	Route::get('/admin/product/list',              array('as' => 'admin.product.index', 'uses' => 'ProductController@index'));
	Route::get('/admin/product/edit/{id}',         array('as' => 'admin.product.edit', 'uses' => 'ProductController@edit'));
	Route::get('/admin/product/create',            array('as' => 'admin.product.create', 'uses' => 'ProductController@create'));
	Route::post('/admin/product/store',       		array('as' => 'admin.product.store', 'uses' => 'ProductController@store'));
	Route::put('/admin/product/update/{id}',       array('as' => 'admin.product.update', 'uses' => 'ProductController@update'));
	Route::delete('/admin/product/destroy/{id}',   array('as' => 'admin.product.destroy', 'uses' => 'ProductController@destroy'));
    Route::post('/admin/product/updateStatus/{id}',array('as' => 'admin.product.updateStatus', 'uses' => 'ProductController@updateStatus'));
    
    //Routes for contact
    Route::get('/admin/contact/list',              array('as' => 'admin.contact.index', 'uses' => 'ContactController@index'));
    Route::get('/admin/contact/view/{id}',         array('as' => 'admin.contact.view', 'uses' => 'ContactController@view'));
    Route::delete('/admin/contact/destroy/{id}',   array('as' => 'admin.contact.destroy', 'uses' => 'ContactController@destroy'));
	
	//Routes for about
    Route::get('/admin/about/list',                   array('as' => 'admin.about.index', 'uses' => 'AboutController@index'));
    Route::put('/admin/about/update',                 array('as' => 'admin.about.update', 'uses' => 'AboutController@update'));
});